import router from './router';
import store from "./store";
const whiteList = ['/login','/404'];
router.beforeEach((to,from,next) => {
    if(store.state.token) {
        if(to.path === '/login') {
            next('/deviceManagement')
        } else {
            next()
        }
    } else {
        if(whiteList.includes(to.path)) {
            next()
        } else {
            next('/login')
        }
    }
})